package cn.iocoder.yudao.module.system.convert.merchant;

import cn.iocoder.yudao.module.system.controller.admin.merchant.vo.AdminGetMerchantRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.merchant.MerchantDO;
import cn.iocoder.yudao.module.system.enums.merchant.MerchantIdentity;

import java.util.ArrayList;
import java.util.List;

public class MerchantConvert {

    public List<AdminGetMerchantRespVO> convertList(List<MerchantDO> lists){
        List<AdminGetMerchantRespVO> result= new ArrayList<>();
        for(int i = 0;i<lists.size();i++){
            AdminGetMerchantRespVO adminGetMerchantRespVO = new AdminGetMerchantRespVO();
            MerchantDO merchantDO = lists.get(i);
            adminGetMerchantRespVO.setMerchantId(merchantDO.getMerchantId());
            adminGetMerchantRespVO.setMerchantName(merchantDO.getMerchantName());
            adminGetMerchantRespVO.setMerchantIdentity(adminGetMerchantRespVO.getMerchantIdentity());
            adminGetMerchantRespVO.setBusinessLicense(merchantDO.getBusinessLicense().split(","));
            adminGetMerchantRespVO.setLegalRepresentative(merchantDO.getLegalRepresentative());
            adminGetMerchantRespVO.setIdentityCard(merchantDO.getIdentityCard().split(","));
            adminGetMerchantRespVO.setContactPerson(merchantDO.getContactPerson());
            adminGetMerchantRespVO.setContactPhone(merchantDO.getContactPhone());
            adminGetMerchantRespVO.setContactEmail(merchantDO.getContactEmail());
            adminGetMerchantRespVO.setStatus(merchantDO.getStatus());
            adminGetMerchantRespVO.setMerchantIdentity(MerchantIdentity.getName(merchantDO.getMerchantIdentity()));
            adminGetMerchantRespVO.setContactAddress(merchantDO.getContactAddress());
            adminGetMerchantRespVO.setWebUrl(merchantDO.getWebUrl().split(","));
            adminGetMerchantRespVO.setEstablishedDate(merchantDO.getEstablishedDate());
            adminGetMerchantRespVO.setMainProduct(merchantDO.getMainProduct());
            adminGetMerchantRespVO.setDescription(merchantDO.getDescription());
            adminGetMerchantRespVO.setOfflineSale(merchantDO.isOfflineSale());
            adminGetMerchantRespVO.setActive(merchantDO.isActive());
            adminGetMerchantRespVO.setCreateTime(merchantDO.getCreateTime());
            result.add(adminGetMerchantRespVO);
        }
         return result;
    }
}
